import website from 'src/const/website'
export default {
  methods: {
    // 动态Image赋值
    assemblyPdtImg (imgUrl) {
      if (!imgUrl) return ''
      return imgUrl.startsWith('http') ? imgUrl : this.baseUrl + imgUrl
    },
    checkProductIsPNG (product) {
      if (!product) return false
      if (~product.indexOf('?')) return /\.[pP][nN][gG]$/.test(product.split('?')[0])
      return /\.[pP][nN][gG]$/.test(product)
    }
  },
  computed: {
    baseUrl: {
      get: function () {
        return website.baseURL
      }
    }
  }
}
